package com.uuah.server.config.spring.parsers.processors;

import org.w3c.dom.Element;

import com.uuah.server.config.spring.parsers.AbstractUuahBeanDefinitionParser;
import com.uuah.server.config.spring.parsers.PreProcessor;
import com.uuah.server.config.spring.parsers.assembly.configuration.IPropertyConfiguration;
import com.uuah.server.config.spring.parsers.generic.AutoIdUtils;

public class ProvideDefaultNameFromElement implements PreProcessor {

	public void preProcess(IPropertyConfiguration config, Element element) {
		if (AutoIdUtils.blankAttribute(element,
				AbstractUuahBeanDefinitionParser.ATTRIBUTE_NAME)) {
			element.setAttribute(
					AbstractUuahBeanDefinitionParser.ATTRIBUTE_NAME, element
							.getLocalName());
		}
	}

}